# Maintainer: Muflone http://www.muflone.com/contacts/english/
# Contributor: Ordoban <dirk.langer@vvovgonik.de>
# Contributor: John D Jones III AKA jnbek <jnbek1972 -_AT_- g m a i l -_Dot_- com>

pkgname=perl-gtk3
_perl_module=Gtk3
pkgver=0.038
pkgrel=3
pkgdesc="Perl interface to the 3.x series of the GTK+ toolkit"
arch=('any')
url="https://metacpan.org/release/${_perl_module}"
license=('LGPL')
checkdepends=('ttf-dejavu' 'xorg-server-xvfb')
depends=('gtk3' 'perl-cairo-gobject' 'perl-glib-object-introspection')
source=("https://cpan.metacpan.org/authors/id/X/XA/XAOC/${_perl_module}-${pkgver}.tar.gz")
sha256sums=('70dc4bf2aa74981c79e15fd298d998e05a92eba4811f1ad5c9f1f4de37737acc')
options=('!emptydirs')

build() {
  cd "${_perl_module}-${pkgver}"
  unset PERL5LIB PERL_MM_OPT PERL_MB_OPT PERL_LOCAL_LIB_ROOT
  export PERL_MM_USE_DEFAULT=1 PERL_AUTOINSTALL=--skipdeps
  perl Makefile.PL
  make
}

check() {
  cd "${_perl_module}-${pkgver}"
  unset PERL5LIB PERL_MM_OPT PERL_MB_OPT PERL_LOCAL_LIB_ROOT
  export PERL_MM_USE_DEFAULT=1
  xvfb-run -a -s "-extension GLX -screen 0 1280x1024x24" make test
}

package() {
  cd "${_perl_module}-${pkgver}"
  unset PERL5LIB PERL_MM_OPT PERL_MB_OPT PERL_LOCAL_LIB_ROOT
  make pure_install INSTALLDIRS=vendor DESTDIR="${pkgdir}"
  # Delete unuseful files
  find "${pkgdir}" -name '.packlist' -delete
}
